import time

from appium import webdriver

# 创建了一个空字典
desired_caps = dict()
# 平台的名字
desired_caps['platformName'] = 'android'
# 手机的版本
desired_caps['platformVersion'] = '5'
# 设备的名字
desired_caps['deviceName'] = 'huawei p30'
# 要打开的程序的包名
desired_caps['appPackage'] = 'com.android.settings'
# 要打开的程序的界面名
desired_caps['appActivity'] = '.Settings'

driver = webdriver.Remote('http://192.168.41.134:4723/wd/hub', desired_caps)

print(driver.page_source)

driver.find_element_by_xpath("//*[@text='电池']").click()

#
# driver.find_element_by_id("com.android.settings:id/search").click()
# driver.find_element_by_class_name("android.widget.EditText").send_keys("hello")
# driver.find_element_by_xpath("//*[@content-desc='收起']").click()
#
# time.sleep(5)
# driver.quit()


